package test;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.wtb.dao.impl.RrDaoImpl;
import com.wtb.pub.WtbBaseServlet;
import com.wtb.rr.domain.RrDetailInfo;
import com.wtb.rr.domain.RrOauth;
import com.wtb.utils.JdbcUtils;
import com.wtb.utils.RrTokenUtils;

public class UpdateData extends WtbBaseServlet {
	public void doPost(HttpServletRequest request, HttpServletResponse response)
	throws ServletException, IOException {
		RrTokenUtils rrTokenUtils = new RrTokenUtils();
		RrDaoImpl rrDaoImpl = new RrDaoImpl();
		List<RrOauth> all = rrDaoImpl.getAll();
		for (RrOauth rrOauth : all) {
			RrDetailInfo rrDetailInfo = rrTokenUtils.getUserInfo(rrOauth);
			rrDaoImpl.update(rrDetailInfo);
			JdbcUtils.commit();
			System.out.println(rrDetailInfo.getUni());
		}
	}
	
}
